

if(Meteor.isServer){

    if(Roles.getAllRoles().count() === 0){
        console.log('no role ？');
        console.log('add admin and manager to role');
        Roles.createRole('admin');
        Roles.createRole('manager');
    }
    console.log('roles list: ');
    console.log(Roles.getAllRoles().fetch());

    Accounts.config({
        sendVerificationEmail:true,
        forbidClientAccountCreation:true,
        loginExpirationInDays:90,
        oauthSecretKey:"onsqJ+1e4icFlV0nbZYAbg=="
    });

    Accounts.onCreateUser(function(options, user){
        if(Meteor.users.count() === 0){
            console.log("no user, the first user is super admin user");
            Roles.addUsersToRoles(user, Roles.getAllRoles().fetch(),Roles.GLOBAL_GROUP);
        }
    });
}